<script>
export default {
  data() {
    return {
      tableData: []
    }
  },
  methods:{
    loadGet(){
      this.$axios.get('http://localhost:8180/user/list').then(res=>res.data).then(res=>{
        console.log(res)
      })
    },
    loadPut(){
      this.$axios.post('http://localhost:8180/user/listP',{}).then(res=>res.data).then(res=>{
        console.log(res)
        this.tableData=res
      })
    }
  },
  beforeMount() {
    //  this.loadGet();
      this.loadPut();
  }
};
</script>

<template style="height: 100%">
  <el-table :data="tableData" style="height: 100%">
    <el-table-column prop="id" label="ID" width="120">
    </el-table-column>
    <el-table-column prop="no" label="账号" width="140">
    </el-table-column>
    <el-table-column prop="name" label="姓名" width="140">
    </el-table-column>
    <el-table-column prop="age" label="年龄" width="100">
    </el-table-column>
    <el-table-column prop="roleId" label="角色" width="100">
      <template slot-scope="scope">
        <el-tag
            :type="scope.row.roleId ===1?'primary':'success'"
            disable-transitions>{{scope.row.roleId === 1?'用户':'管理员'}}</el-tag>
      </template>
    </el-table-column>
    <el-table-column prop="sex" label="性别" width="100">
      <template slot-scope="scope">
        <el-tag
                :type="scope.row.sex ===1?'primary':'success'"
                disable-transitions>{{scope.row.sex === 1?'男':'女'}}</el-tag>
      </template>
    </el-table-column>
    <el-table-column prop="phone" label="电话" width="140">
    </el-table-column>
  </el-table>
</template>

<style scoped>

</style>